package com.asen.commons.core.base.controller;

import com.asen.commons.core.base.domain.TreeBase;
import com.asen.commons.core.base.vo.DcPage;
import com.asen.commons.constants.BaseConstant;
import com.asen.commons.core.meta.dao.Condition;
import com.asen.commons.core.base.service.TreeBaseService;
import com.asen.commons.core.base.result.ApiResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 树型基础资料Controller
 *
 * @author Gary
 * @version 1.0
 * @date 2018-12-10
 */
public abstract class AbstractTreeBaseController<T extends TreeBase, D, V, S extends TreeBaseService<T>> extends AbstractBaseDataController<T, D, V, S> {

    @ApiOperation(value = "树查询", httpMethod = BaseConstant.API_POST_METHOD)
    @RequestMapping(value = "/treeList")
    public ApiResult<DcPage<V>> treeList(@RequestBody D dto) throws Exception {
        Condition condition = newCondition();
        buildCondition(condition, dto);
        DcPage<V> pageInfo = query(condition);
        return success(pageInfo);
    }
}
